package com.weblog.follow.controller;

import com.weblog.follow.service.FocusService;
import com.weblog.model.user.vo.FansInfoVo;
import entity.PageResult;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author MaoLin Wang
 * @date 2019/10/3118:06
 */
@RestController
@CrossOrigin
@RequestMapping("/follow")
public class FocusController {

    @Autowired
    private FocusService focusService;


    @GetMapping("/fans/{id}/{page}/{size}")
    public Result fansList(@PathVariable("id")String id,@PathVariable("page")int page,@PathVariable("size")int size){
        PageResult<List<FansInfoVo>> pageResult = focusService.fansList(id, page, size);
        return new Result(true, StatusCode.OK,"粉丝列表加载成功",pageResult);
    }

    @GetMapping("/focus/{id}/{page}/{size}")
    public Result focusList(@PathVariable("id")String id,@PathVariable("page")int page,@PathVariable("size")int size){
        PageResult<List<FansInfoVo>> pageResult = focusService.focusList(id, page, size);
        return new Result(true, StatusCode.OK,"关注列表加载成功",pageResult);
    }
}
